<style type="text/css" media="screen">
.my-uploadify-button {
    background:none;
    border: none;
    text-shadow: none;
    border-radius:0;
}

.uploadify:hover .my-uploadify-button {
    background:none;
    border: none;
}

.fileQueue {
    width: 552px;
    height: 140px;
    overflow: auto;
    border-style: solid;
    border-width: 1px 0 0 0;
    border-color: #E5E5E5;
}

#fileupload
{
margin-bottom: 5px;
}

.resQuery span.error {
    position: absolute !important;
    left: 260px;
}

</style>
<div class="pageContent">
    <form method="post"
        action="${rc.getContextPath()}/manage/maintainConfig/saveMaintainConfig"
        class="pageForm required-validate"
        onsubmit="return validateCallback(this, subDone);">
        <div class="pageFormContent">
            <input type="hidden" name="navTabId" value="${navTabId!''}">
            <input type="hidden" name="id"
                value="<#if (config.equipmentCode)??>${config.equipmentCode!''}</#if>">
                <input type="hidden" id="fileJson">
            <fieldset class="dataset">
                <dl>
                    <dt><@label key="equipmentCode.C,colon">设备编号：</@label></dt>
                    <dd class="resQuery">
                      <input class="required look" id="equipmentLookup.equipmentCode" name="equipmentCode" type="text" postField="equipmentCode" suggestFields="equipmentCode,equipmentText" 
                    suggestUrl="${rc.getContextPath()}/manage/equipment/equipmentSuggest" lookupGroup="equipmentLookup"
                    warn="<@label key='equipmentCode.C,doesNotExist.C'>设备编号不存在</@label>"  remote="${rc.getContextPath()}/manage/equipment/validateEquipmentCodeForSelect"/>
                    <a class="btnLook" href="${rc.getContextPath()}/manage/equipment/equipmentLookUp" rel="equipmentLookup_dialog" width="700" height="450" lookupGroup="equipmentLookup" ><span><@label key="equipmentSelect.C">设备选择</@label></span></a>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key='equipmentText.C,colon'>设备描述：</@label></dt>
                <dd><input id="equipmentLookup.equipmentText" readonly size="22" type="text" maxlength="60" name="equipmentText"  />
            </dd>
                </dl>
                <dl>
                    <dt><@label key="strategyCode.C,colon">维护策略编号：</@label></dt>
                    <dd>
                      <input class="required" id="strategyLookup.strategyCode" name="strategyCode" type="text" postField="strategyCode" suggestFields="strategyCode,strategyText" 
                    suggestUrl="${rc.getContextPath()}/manage/maintainStrategy/strategySuggest" lookupGroup="strategyLookup"
                      warn="<@label key='strategyCode.C,doesNotExist.C'>维护策略编号不存在</@label>"  remote="${rc.getContextPath()}/manage/maintainStrategy/validateStrategyCodeForSelect"/>
                    </dd>
                </dl>
                    <dl>
                    <dt><@label key="strategyText.C,colon">维护策略描述：</@label></dt>
                    <dd>
                        <input readonly id="strategyLookup.strategyText" name="strategyText"
                            size="32" type="text" />
                    </dd>
                </dl>
                    <dl>
                    <dt><@label key="prevMaintainDate.C,colon">上次维护日期：</@label></dt>
                    <dd class="resQuery">
                        <input type="text" class="required date"  readonly="readonly" name="prevMaintainDate" dateFmt="yyyy-MM-dd" /> <a class="inputDateButton" href="javascript:;"><@label key="select.B">选择</@label></a>
                    </dd>
                </dl>
                                <dl>
                    <dt><@label key="nextMaintainDate.C,colon">下次维护日期：</@label></dt>
                    <dd>
                        <input type="text" readonly="readonly" name="nextMaintainDate" dateFmt="yyyy-MM-dd"/>
                    </dd>
                </dl>
                                <dl>
                    <dt><@label key="currCountValue.C,colon">当前损耗点：</@label></dt>
                    <dd>
                        <input type="text" class="required digits" name="currCountValue" value="0" maxlength="10"/>
                    </dd>
                </dl>
                    <dl>
                    <dt><@label key="totalCountValue.C,colon">累计损耗点：</@label></dt>
                    <dd>
                        <input type="text" readonly class="required digits" name="totalCountValue" value="0" maxlength="10"/>
                    </dd>
                </dl>
                <dl style="height:200px">
                <dd>
                <fieldset style="border: 1px solid #E5E5E5;padding: 5px;">
                 <legend style="border:none"><@label key="uploadList.C">待上传列表</@label></legend>
                <input id="fileupload" type="file" 
            uploaderOption="{
            swf:'${rc.getContextPath()}/manage/styles/uploadify/scripts/uploadify.swf',
            uploader:'${rc.getContextPath()}/manage/maintainConfig/saveAttachment;jsessionid=${sessionid}',
            fileTypeDesc: 'All Files',
            fileTypeExts: '*.*',  
            queueID:'fileQueue',
            buttonClass:'my-uploadify',
            width:61,
            height:24,
            auto:false,
            buttonText:'<@label key='chooseFile.C'>选择文件</@label>',  
            multi:true,
            simUploadLimit:10,
            onQueueComplete:onUploadSuccess
        }"
    />
        <div id="fileQueue" class="fileQueue"></div>
        </fieldset>
        <dd>
                </dl>
            </fieldset>
        </div>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit"><@label key="save.B">保存</@label></button>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="buttonActiveGrey">
                        <div class="buttonContent">
                            <button type="button" class="close"><@label key="cancel.B">取消</@label></button>
                        </div>
                    </div></li>
            </ul>
        </div>
    </form>
    <div id="mask" class="mask"></div> 
</div>
<script type="text/javascript">
    function subDone(json)
    {
        if(json["statusCode"]==200)
            {
            if($("#fileQueue",$.pdialog.getCurrent()).text()!="")
                {
                var equipmentCode = $("#equipmentLookup\\.equipmentCode",$.pdialog.getCurrent()).val();
                var strategyCode = $("#strategyLookup\\.strategyCode",$.pdialog.getCurrent()).val();
                $("#fileJson",$.pdialog.getCurrent()).val(JSON.stringify(json));
                $('#fileupload',$.pdialog.getCurrent()).uploadify('settings','formData',{'equipmentCode': equipmentCode,'strategyCode':strategyCode});
                $('#fileupload',$.pdialog.getCurrent()).uploadify('upload', '*');
                }
            else
                {
                dialogAjaxDone(json);
                }
    
            }
        else
            {
        
            dialogAjaxDone(json);
            }
        
      
    }
    
    function fileSelect()
    {
         $('#fileupload').click();
    }
    
    function onUploadSuccess()
    {
        dialogAjaxDone(jQuery.parseJSON($("#fileJson",$.pdialog.getCurrent()).val()));
    }
    </script>